package com.zeratul.demo.event;

import com.zeratul.common.event.core.apply.subscribe.IZtEventHandler;
import com.zeratul.common.event.core.apply.subscribe.ZtEventListener;
import com.zeratul.common.event.domain.ZtEvent;
import com.zeratul.demo.domain.User;
import lombok.extern.slf4j.Slf4j;

@ZtEventListener(value = "demo-topic", async = true)
@Slf4j
public class MyEventHandler2 implements IZtEventHandler<User> {

    /**
     * 事件处理方法
     *
     * @param topic   - 事件主题
     * @param user       - 事件内容
     * @param ztEvent - 事件对象
     */
    @Override
    public void doHandler(String topic, User user, ZtEvent<User> ztEvent) {
        log.info("事件2接收到了，主题：{} 内容：{} 延迟时间：{}", topic, user, ztEvent.getDelayMsTime());
    }
}
